package hust.att2.adapter;

import hust.att2.movieticketing.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class ImageAdapter extends BaseAdapter {
	private Context context;
	private final String[] filmValues;

	public ImageAdapter(Context context, String[] filmValues) {
		this.context = context;
		this.filmValues = filmValues;
	}

	public View getView(int position, View convertView, ViewGroup parent) {

		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

		View gridView;

		if (convertView == null) {

			gridView = new View(context);
			gridView = inflater.inflate(R.layout.film_icon, null);
			TextView tvFilmName = (TextView) gridView
					.findViewById(R.id.tv_name);

			TextView tvCategory = (TextView) gridView
					.findViewById(R.id.tv_category);

			ImageView imageView = (ImageView) gridView
					.findViewById(R.id.image);
			imageView.setImageResource(R.drawable.images2);
//			String film = filmValues[position];
//
//			if (film.equals("Windows")) {
//				imageView.setImageResource(R.drawable.icon);
//			} else if (film.equals("iOS")) {
//				imageView.setImageResource(R.drawable.icon);
//			} else if (film.equals("Blackberry")) {
//				imageView.setImageResource(R.drawable.icon);
//			} else {
//				imageView.setImageResource(R.drawable.icon);
//			}

		} else {
			gridView = (View) convertView;
		}

		return gridView;
	}

	public int getCount() {
		return filmValues.length;
	}

	public Object getItem(int position) {
		return null;
	}

	public long getItemId(int position) {
		return 0;
	}

}
